﻿Imports Global_Visas_Business_Layer

Partial Public Class frmCRMMDI

    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MenuItem1.Click
        Dim firstForm As New frmCRMMainForm()
        TabItem1.Content = firstForm
        If GlobalCRM.CurrentCaseID > 0 Then
            'Dim SForm As New frmMainDisplay()
            'TabItem2.Content = SForm
        Else
            'TabItem2.IsSelected = True
        End If
    End Sub

    Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        GeneralTasks.ChangeTheme(Me)
        GeneralTasks.EnumerateandFill(Me.LogicalChildren)
        Dim firstForm As New frmCRMMainForm()
        AddHandler firstForm.ShowDisplayForm, AddressOf LoadMainDisplay
       
        TabItem1.Content = firstForm
        If GlobalCRM.CurrentCaseID > 0 Then
            'Dim SForm As New frmCRMMainDisplay()
            'TabItem2.Content = SForm
            'TabItem2.IsSelected = True
        Else
            TabItem1.IsSelected = True
        End If
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MenuItem2.Click
        'Dim Mailbox As New frmMailbox()
        'TabItem2.Content = Mailbox
        
    End Sub
    Public Sub LoadFrontPage()
        Dim firstForm As New frmCRMMainForm()
        TabItem1.Content = firstForm
    End Sub
    Public Sub LoadMainDisplay(ByVal formName As String)
        If formName.ToUpper.Trim = "MAINDISPLAY" Then
            Dim secondForm As New frmCRMMainDisplay()
            TabItem2.Content = secondForm
            TabItem2.Focus()
        End If
    End Sub
    Public Sub LoadMainPage()
        If GlobalCRM.CurrentCaseID > 0 Or GlobalCRM.CurrentCandidateID > 0 Or GlobalCRM.CurrentContactID > 0 Or GlobalCRM.CurrentCompanyID > 0 Then
            ' Dim firstForm As New frmMainDisplay()
            'TabItem1.Content = firstForm
        End If
    End Sub

    Private Sub frmCRMMDI_Unloaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Unloaded
        End
    End Sub
End Class
